dotnetCHARTING Send comments on this topic.
WeightedMovingAverage(SeriesCollection,Double[]) Method
See Also 
dotnetCHARTING Namespace > StatisticalEngine Class > WeightedMovingAverage Method : WeightedMovingAverage(SeriesCollection,Double[]) Method


sc
A collection of series objects. For example, to evaluate this indicator for two series you will need to pass a series collection containing this two series.
weights
Array of doubles which assigns weights to the k-th previous historical values for the given period on which the moving average is being evaluated. Here k is just the length of the weights array given.
Here we evaluate the Weighted Moving Average(WMA) where for each period for which the WMA is evaluated the historical terms are weighted in accordance with the same set of weights.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function WeightedMovingAverage( _
   ByVal sc As SeriesCollection, _
   ByVal weights() As Double _
) As SeriesCollection
Visual Basic (Usage)Copy Code
Dim sc As SeriesCollection
Dim weights() As Double
Dim value As SeriesCollection
 
value = StatisticalEngine.WeightedMovingAverage(sc, weights)
C# 
public static SeriesCollection WeightedMovingAverage( 
   SeriesCollection sc,
   double[] weights
)

Parameters

sc
A collection of series objects. For example, to evaluate this indicator for two series you will need to pass a series collection containing this two series.
weights
Array of doubles which assigns weights to the k-th previous historical values for the given period on which the moving average is being evaluated. Here k is just the length of the weights array given.

Return Value

A series where the first term is the value of the moving average corresponding of the latest period, the second term is the value for the previous period and so on.

Exceptions

ExceptionDescription
ArgumentExceptionThrown if the length of the weights and series differ or if either array is empty.

Remarks

I.e. The weights shift with the window of the historical values.

Application

Generally speaking the WMA is used in order to allow more weight to be assigned to more resent price dynamics. Here the length of the weights array is used as the length of the period over which the moving average is calculated. If you wish to control the number of periods used within the moving average then we refer you to (historicalPrices, weights, lengthOfMovingAverage).

See Also

© 2010 All Rights Reserved.